package com.example.springboot.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/cpi")
public class HelloController {

    //    @Value("${cupSize}")
//    private String cupSize;
//
//    @Value("${age}")
//    private Integer age;
    @Autowired
    private GirlProperties girlProperties;

    @RequestMapping(value = {"/say/{id}"}, method = RequestMethod.GET)
    public String say(@PathVariable("id") Integer id) {
//        return "hello Spring Boot! cupSize is " + cupSize + " age is " + age;
        return "hello Spring Boot! girlProperties " + girlProperties.getAge() + " say id " + id;
    }

//    @RequestMapping(value = {"/say2"}, method = RequestMethod.GET)
    @GetMapping(value = "/say")
    public String say2(@RequestParam(value = "id", required = false, defaultValue = "0") Integer id) {
//        return "hello Spring Boot! cupSize is " + cupSize + " age is " + age;
        return "hello Spring Boot! girlProperties " + girlProperties.getAge() + " say2 id " + id;
    }
}
